package com.seckill.dto;

/**
 * @Creation_time 2017/9/8
 * @Theme 封装json结果
 * @Autor Xiao Yiyun
 */
public class SeckillResult<T> {

    //判断请求是否成功
    private boolean success;
    //泛型数据
    private T data;
    //异常
    private String error;

    //构造器
    //秒杀成功，返回数据
    public SeckillResult(boolean success, T data) {
        this.success = success;
        this.data = data;
    }
    //秒杀失败，返回错误信息
    public SeckillResult(boolean success, String error) {
        this.success = success;
        this.error = error;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }
}
